package com.netease.xone.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;

import com.netease.pkgRelated.XoneConsts;
import com.netease.pkgRelated.XoneConsts.BUNDLE_KEY;
import com.netease.xone.R;
import com.netease.xone.fragment.FragmentBase;
import com.netease.xone.fragment.FragmentShare;

public class ActivityShare extends ActivityX1Base {
	public static final String TAG = ActivityShare.class.getSimpleName();
	
	public static void launch(Context context, int type) {
		Intent i = new Intent(context, ActivityShare.class);
		i.putExtra(BUNDLE_KEY.WB_BIND_TYPE, type);
		context.startActivity(i);
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Intent intent = getIntent();
        int type = 0;
       
        if (intent != null) {
            type = intent.getIntExtra(XoneConsts.EXTRA_OPERATE, 0);
        }
        
        FrameLayout linear = new FrameLayout(this);
        linear.setId(R.id.activity_share_container_id);
        setContentView(linear);
        
        if (null != findViewById(R.id.activity_share_container_id) && savedInstanceState == null) {
            FragmentManager fm = getSupportFragmentManager();
            FragmentTransaction ft = fm.beginTransaction();
            FragmentBase frag = null;
            
            frag = FragmentShare.newInstance(type);
           
            ft.add(R.id.activity_share_container_id, frag, TAG);
            ft.commit();
        }
	}
	 
}
